cmake_minimum_required(VERSION 3.10)

project(RandomMath)

set(CMAKE_CXX_STANDARD 17)

set (CONAN_BUILD_FILES
    conan_paths.cmake
)

macro(FIND_CONANINFO)    
    find_path(
        CONAN_BUILD
        NAMES ${CONAN_BUILD_FILES}
        HINTS ${CMAKE_SOURCE_DIR}/conaninfo
    )

    if (DEFINED CONAN_BUILD)
        set(CONAN_FOUND True)
    endif()
endmacro(FIND_CONANINFO)

message(CHECK_START "Find `conaninfo` directory")
FIND_CONANINFO()

# if the coan build directory is not exist call conanbuild.ps1
if (NOT DEFINED CONAN_FOUND)

    message(CHECK_FAIL "Current not found `conaninfo` directory, will call conanbuild script for you")

    execute_process(
        COMMAND powershell "./conanbuild.ps1"
        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
    )

    FIND_CONANINFO()
    if (NOT DEFINED CONAN_FOUND)
        message(FATAL_ERROR "Cannot find `conaninfo` directory, terminate process!")
    endif()
endif()

message(CHECK_PASS "`conaninfo` directory is found")

include(${CMAKE_SOURCE_DIR}/conaninfo/conan_paths.cmake)

include(src/CMakeLists.txt)

add_executable(App ${ALL_FILE})

find_package(stb)

if(TARGET stb::stb)
    target_include_directories(App PRIVATE ${stb_INCLUDE_DIRS})
endif()

target_compile_definitions(App PRIVATE -DOUTPUT_DIR="${CMAKE_SOURCE_DIR}/data/")